#coding=utf8

import os
import click

from pypkg import util
from pypkg import exceptions
from pypkg import template

@click.group()
def cli():
    pass


@cli.command()
@click.argument('name')
def new(name):
    if os.path.exists(name) and not util.is_empty_dir(name):
        print u"目录{}不为空".format(name)
        return

    from_ = util.get_templates_dir()
    to = name
    ctx = {
        'pkg_name': name,
    }

    template.copy_dir(from_, to, ctx)


def run():
    cli()


if __name__ == '__main__':
    run()
